<?php
$con = mysql_connect("localhost","root","root");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("faithwar", $con);
date_default_timezone_set("PRC"); //timezone
$dateTime = date("Y-m-d",strtotime("-1 day"));
#$dateTime = date("Y-m-d");
#$dateTime = '2012-03-28';
$logdate =  mysql_query("SELECT DISTINCT dataTime FROM `faithwar_query`");
//while($everylogdate = mysql_fetch_array($logdate))
//{
 /* mysql_query("INSERT INTO faithwar_query_temp
SELECT max(id),
  firstlogindata,
  firstlogin,
  money,
  TcRechargeNum,
  TcUsedNum,
  TcInventoryNum,
  str2,
  countryId,
  d1,
  str1,
  d2,
  targetCount,
  cityId,
  action,
  targetId,
  gold,
  heroId,
  dayTotalTime,
  level,
  deviceid,
  createdate,
  date
FROM faithwar_query
GROUP BY deviceid");*/
//} WHERE dataTime = '$everylogdate[dataTime]'

  mysql_query("INSERT INTO faithwar_query_temp SELECT NULL,
  firstlogindata,
  firstlogin,
  money,
  TcRechargeNum,
  TcUsedNum,
  TcInventoryNum,
  str2,
  countryId,
  d1,
  str1,
  d2,
  targetCount,
  cityId,
  action,
  targetId,
  gold,
  heroId,
  dayTotalTime,
  level,
  cities,
  deviceid,
  createdate,
  date  FROM  faithwar_query");

mysql_close($con);
?>